import request from '@/utils/request/req';

// 查询所有标签
export function getAllLabel(name?: string) {
  return request({
    url: '/msg/getAllLabel',
    method: 'get',
    params: name ? { name } : undefined
  });
}

// 新增标签库
export function addLabel(name: string) {
  return request({
    url: '/msg/addLabel',
    method: 'post',
    data: { name }
  });
}

// 修改标签库
export function updateLabel(id: string, name: string) {
  return request({
    url: '/msg/updateLabel',
    method: 'post',
    data: { id, name }
  });
}

// 删除标签库
export function deleteLabel(id: string) {
  return request({
    url: '/msg/deleteLabel',
    method: 'post',
    data: { id }
  });
}

// 更改当前客户的标签
export function updateUserLabel(ids: string, myWxId: string, sendWxId: string, type: string) {
  return request({
    url: '/msg/updateUserLabel',
    method: 'post',
    data: { ids, myWxId, sendWxId, type }
  });
}

// 获取客户标签列表
export function getCustomerLabel(data: { wxId: string; customerName?: string; labels?: string; current: number; size: number; type?: string | number }) {
  return request({
    url: '/msg/getCustomerLabel',
    method: 'get',
    params: data
  });
}
